Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 2 - Control Manager Reference / Control Manager Functions
Handling Events in Controls /


FindControlUnderMouse

NEW WITH THE APPEARANCE MANAGER

Determines whether a mouse-down event has occurred in a control and, if so, in which.

pascal ControlHandle FindControlUnderMouse (
                     Point inWhere,
                     WindowPtr inWindow,
                     SInt16 *outPart);
inWhere
On input, a point, specified in coordinates local to the window, where the mouse-down event occurred. Before calling FindControlUnderMouse, use the QuickDraw GlobalToLocal function to convert the point stored in the where field of the event structure (which describes the location of the mouse-down event) to coordinates local to the window.
inWindow
On input, a pointer to the window in which the mouse-down event occurred.
outPart
On output, a pointer to the part code of the control part which was selected; see "Control Part Code Constants".
function result
Returns a handle to the control that was selected. If the mouse-down event did not occur over a control part, nil is returned.
DISCUSSION
You should call the FindControlUnderMouse function instead of FindControl to determine whether a mouse-down event occurred in a control, particularly if an embedding hierarchy is present. FindControlUnderMouse will return a handle to the control even if no part was hit and can determine whether a mouse-down event has occurred even if the control is deactivated, while FindControl does not.

When a mouse-down event occurs, your application should call FindControlUnderMouse after using the Window Manager function FindWindow to ascertain that a mouse-down event has occurred in the content region of a window containing controls.

SEE ALSO
"Embedding Controls".

"Appearance Manager Gestalt Selector Constants".


Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998